<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>使用BEM+emmet的css书写与命名技巧[未完] | leenty blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="于日常的项目中，小型项目还好，css即使没怎么规划也不至于特别的乱，但一旦项目里css有一定的基数时，css就会显得混乱起来。于是。。。（以下是案例，可以直接跳至[正文]有关css命名的部分） 可能就遇到了这种情况:情况1.哎呀！这个地方布局有点问题，我改一下，于是看到了一堆css选择器，当你想要修改某个class时又害怕会影响到其他在使用这个class的组件，于是就很尴尬的又写了一个class加">
<meta name="keywords" content="css">
<meta property="og:type" content="article">
<meta property="og:title" content="使用BEM+emmet的css书写与命名技巧[未完]">
<meta property="og:url" content="http://baidu.com/2016/11/06/css/index.html">
<meta property="og:site_name" content="leenty blog">
<meta property="og:description" content="于日常的项目中，小型项目还好，css即使没怎么规划也不至于特别的乱，但一旦项目里css有一定的基数时，css就会显得混乱起来。于是。。。（以下是案例，可以直接跳至[正文]有关css命名的部分） 可能就遇到了这种情况:情况1.哎呀！这个地方布局有点问题，我改一下，于是看到了一堆css选择器，当你想要修改某个class时又害怕会影响到其他在使用这个class的组件，于是就很尴尬的又写了一个class加">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2016-11-20T14:48:12.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用BEM+emmet的css书写与命名技巧[未完]">
<meta name="twitter:description" content="于日常的项目中，小型项目还好，css即使没怎么规划也不至于特别的乱，但一旦项目里css有一定的基数时，css就会显得混乱起来。于是。。。（以下是案例，可以直接跳至[正文]有关css命名的部分） 可能就遇到了这种情况:情况1.哎呀！这个地方布局有点问题，我改一下，于是看到了一堆css选择器，当你想要修改某个class时又害怕会影响到其他在使用这个class的组件，于是就很尴尬的又写了一个class加">
  
    <link rel="alternative" href="/atom.xml" title="leenty blog" type="application/atom+xml">
  
  
    <link rel="icon" href="//favicon.png">
  
  <script src="/style.js"></script>
  

  
<!-- baidu_tongji -->
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?5bae4c35e53fde3bf2526312c3edaf1d";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- End baidu_tongji -->


</head>
</html>
<body>
  <div id="container">
    <div class="left-col">
      <div class="overlay"></div>
<div class="intrude-less">
	<header id="header" class="inner">
		<a href="/" class="profilepic">
			
			<img src="/img/default_avatar.png" class="js-avatar">
			
		</a>

		<hgroup>
		  <h1 class="header-author"><a href="/">leenty</a></h1>
		</hgroup>

		

		<nav class="header-menu">
			<ul>
			
				<li><a href="/">主页</a></li>
	        
				<li><a href="/archives">所有文章</a></li>
	        
			</ul>
		</nav>
		<nav class="header-smart-menu">
	        
    		
    			
    			<a class="js-smart-menu" data-idx="0" href="javascript:void(0)">所有文章</a>
    			
    			
            
    			
    			<a class="js-smart-menu" data-idx="1" href="javascript:void(0)">标签</a>
    			
    			
            
    			
    			<a class="js-smart-menu" data-idx="2" href="javascript:void(0)">友链</a>
    			
    			
            
    			
    			<a class="js-smart-menu" data-idx="3" href="javascript:void(0)">关于我</a>
    			
    			
            
		</nav>
		<nav class="header-nav">
			<div class="social">
				
					<a class="github" target="_blank" href="https://github.com/leenty" title="github">github</a>
		        
			</div>
		</nav>
	</header>		
</div>

    </div>
    <div class="mid-col">
      <nav id="mobile-nav">
  	<div class="overlay">
  		<div class="slider-trigger"><i class="icon-list"></i></div>
  		<h1 class="header-author js-mobile-header hide">leenty</h1>
  	</div>
	<div class="intrude-less">
		<header id="header" class="inner">
			<div class="profilepic">
				
					<img src="/img/default_avatar.png" class="js-avatar">
				
			</div>
			<hgroup>
			  <h1 class="header-author">leenty</h1>
			</hgroup>
			
			<nav class="header-menu">
				<ul>
				
					<li><a href="/">主页</a></li>
		        
					<li><a href="/archives">所有文章</a></li>
		        
				</ul>
			</nav>
			<nav class="header-nav">
				<div class="social">
					
						<a class="github" target="_blank" href="https://github.com/leenty" title="github">github</a>
			        
				</div>
			</nav>
		</header>				
	</div>
</nav>

      <div class="body-wrap">
        <article id="post-css" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      使用BEM+emmet的css书写与命名技巧[未完]
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>于日常的项目中，小型项目还好，css即使没怎么规划也不至于特别的乱，但一旦项目里css有一定的基数时，css就会显得混乱起来。<br>于是。。。（以下是案例，可以直接跳至<a href="#main">[正文]有关css命名的部分</a>）</p>
<h3 id="可能就遇到了这种情况"><a href="#可能就遇到了这种情况" class="headerlink" title="可能就遇到了这种情况:"></a>可能就遇到了这种情况:</h3><h4 id="情况1"><a href="#情况1" class="headerlink" title="情况1."></a>情况1.</h4><p>哎呀！这个地方布局有点问题，我改一下，于是看到了一堆css选择器，当你想要修改某个class时又害怕会影响到其他在使用这个class的组件，于是就很尴尬的又写了一个class加在上面。</p>
<h4 id="情况2"><a href="#情况2" class="headerlink" title="情况2."></a>情况2.</h4><p>css命名冲突，你将要命名的class命已经被使用，更惨的是其他意思相近的命名单词也被使用了，这下就词穷了🤕</p>
<h4 id="情况3"><a href="#情况3" class="headerlink" title="情况3."></a>情况3.</h4><p>毫无意义的命名：(写的时候class的意思只有自己和上帝知道，现在只有上帝知道了🙆🏻)<br><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.abc</span> &#123;</span><br><span class="line">    <span class="attribute">width</span>: <span class="number">200px</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>其他前端：一脸懵逼</p>
<h3 id="针对上面的问题，于是就在命名上开始做出改变，然而却😟"><a href="#针对上面的问题，于是就在命名上开始做出改变，然而却😟" class="headerlink" title="针对上面的问题，于是就在命名上开始做出改变，然而却😟"></a>针对上面的问题，于是就在命名上开始做出改变，然而却😟</h3><h4 id="情况4"><a href="#情况4" class="headerlink" title="情况4."></a>情况4.</h4><p>过于语义化的命名（这里举个略微夸张且有些不恰当的栗子🌰）<br><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.navigation-width-full-line</span>&#123;</span><br><span class="line">    <span class="attribute">width</span>: <span class="number">100%</span>;</span><br><span class="line">    <span class="attribute">height</span>: <span class="number">50px</span>;</span><br><span class="line">&#125;</span><br><span class="line">``` </span><br><span class="line">这样是把意义描述清楚了，但是命名却是过长了</span><br><span class="line">#### 情况5. </span><br><span class="line">有语义却不够直接简洁的命名    </span><br><span class="line">```<span class="selector-tag">css</span></span><br><span class="line"><span class="selector-class">.navigation-responsive</span>&#123;</span><br><span class="line">    <span class="attribute">flex</span>: <span class="number">1</span> <span class="number">1</span> <span class="number">10%</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>这样无形中增加了记忆成本</p>
<h3 id="命名规范-BEM"><a href="#命名规范-BEM" class="headerlink" title="命名规范 BEM"></a>命名规范 BEM</h3><p>BEM是我很喜欢的一个命名规范<br>命名规则简单直接又不至于混乱<br>BEM的意思就是块（block）、元素（element）、修饰符（modifier）<br><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">.block &#123;&#125; // 顶级命名，代表了一类元素块或者一个模块</span><br><span class="line">.block__element &#123;&#125; // 次级命名(使用两个英文下划线连接，后跟随次级名称，表示次级元素或属性)</span><br><span class="line">.block--modifier &#123;&#125; // 状态命名(使用两个英文中划线连接，后跟随修饰符或状态名)</span><br></pre></td></tr></table></figure></p>
<p>这样的写法可以的好处是可以避免css的嵌套，可以加快css渲染时的速度<br><strong> 栗子🌰 </strong><br><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!-- 旧版命名 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"person"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"head"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"body"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"foot"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"pug"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"head"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"body"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"foot"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">style</span>&gt;</span></span><br><span class="line">    // css选择时需要两个class</span><br><span class="line"><span class="css">    <span class="selector-class">.person</span> <span class="selector-class">.head</span> &#123;</span></span><br><span class="line">        width: 100px;</span><br><span class="line">    &#125;</span><br><span class="line"><span class="xml"><span class="tag">&lt;/<span class="name">styles</span>&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="xml"><span class="comment">&lt;!-- BEM命名 --&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"person"</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"person__head"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"person__body"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"person__foot"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"pug"</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"pug__head"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"pug__body"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"pug__foot"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">style</span>&gt;</span></span></span><br><span class="line">    // css选择时只要一个class</span><br><span class="line"><span class="css">    <span class="selector-class">.person__head</span> &#123;</span></span><br><span class="line">        width: 100px;</span><br><span class="line">    &#125;</span><br><span class="line"><span class="xml"><span class="tag">&lt;/<span class="name">styles</span>&gt;</span></span></span><br></pre></td></tr></table></figure></p>
<h3 id="BEM-emmet"><a href="#BEM-emmet" class="headerlink" title="BEM+emmet"></a>BEM+emmet</h3><p>相信很多同学有用过emmet,其前身就是大名鼎鼎的Zen coding<br>想了解的同学可以google一下emmet<br>而emmet对于BEM命名规范其实是有一套快速生成标签的规则的<br>发个栗子🌰<br>在emmet下这段代码<br><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">form.search-form&gt;input.-username+input.-password[type=password]+button.-submit--active|bem</span><br></pre></td></tr></table></figure></p>
<p>按下<code>Tab</code>后会生成<br><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">form</span> <span class="attr">class</span>=<span class="string">"search-form"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">class</span>=<span class="string">"search-form__username"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"password"</span> <span class="attr">class</span>=<span class="string">"search-form__password"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">button</span> <span class="attr">id</span>=<span class="string">"J_Submit"</span> <span class="attr">class</span>=<span class="string">"search-form__submit--active"</span>&gt;</span><span class="tag">&lt;/<span class="name">button</span>&gt;</span> <span class="tag">&lt;<span class="name">form</span>&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>如果仔细看第一段代码与第二段之间的区别就可以看出其中的奥义：</p>
<ul>
<li>首个元素的class选择器会被作为BEM规则的头，后面的每一个以<code>.-</code>开头子元素编译后的class属性都将以这个头为开头</li>
<li>子元素可以以<code>.-</code>开头来代替父元素的class名，省去了重复书写的麻烦(即：<code>.-username</code>被编译成了<code>.search-form__username</code>)</li>
<li>子元素可以跟上<code>--</code>加修饰符来编译(即：<code>.-submit--active</code>被编译成了<code>.search-form__submit--active</code>)</li>
</ul>
<p>这是一种快速生成标签的形式，方便的没话说<br>而有一部分同学已经不再直接写html标签了，而是使用了模板引擎了<br>我用的是pug（也就是之前的jade，现在已经更名为pug了）<br>模板引擎的好处是使整个结构看起来更加清晰有条理，也加快了编写页面的速度，<br>在使用模板引擎后就不在需要emmet了<br>but！<br>虽然不需要了，但是emmet的那种化繁为简的精神是可以继续存在滴，我特别喜欢这样的语法，<br>于是就开始了尝试在css命名上做研究</p>
<p><span id="main"> </span></p>
<h3 id="以下是我vue2-0Demo项目内有关css命名的部分"><a href="#以下是我vue2-0Demo项目内有关css命名的部分" class="headerlink" title="以下是我vue2.0Demo项目内有关css命名的部分"></a>以下是我vue2.0Demo项目内有关css命名的部分</h3><p>一开始看可能会有点懵逼，但是当看完以下6个小点再回头看之前的案例就会明白了<br><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * css命名使用 BEM+emmet 风格作为命名规范</span></span><br><span class="line"><span class="comment"> * </span></span><br><span class="line"><span class="comment"> * 约定[分类名称][属性|组件名称]与[属性名]使用小写</span></span><br><span class="line"><span class="comment"> * 约定[描述]与[状态]使用首字母大写</span></span><br><span class="line"><span class="comment"> * [eg]:</span></span><br><span class="line"><span class="comment"> *  .[分类名称]-[属性|组件名称][描述]--[属性值|状态]</span></span><br><span class="line"><span class="comment"> *    =&gt; .l-flexV--c</span></span><br><span class="line"><span class="comment"> *    =&gt; .b-base--Active</span></span><br><span class="line"><span class="comment"> * </span></span><br><span class="line"><span class="comment"> *  1.约定 [分类名称] 缩写:</span></span><br><span class="line"><span class="comment"> *    • .layout =&gt; .l- (布局部分)</span></span><br><span class="line"><span class="comment"> *    • .utils =&gt; .u- (工具部分)</span></span><br><span class="line"><span class="comment"> *    • .button =&gt; .b- (按钮部分)</span></span><br><span class="line"><span class="comment"> *    </span></span><br><span class="line"><span class="comment"> *  2.约定通用 [属性] 缩写:(以emmet联想风格为缩写)</span></span><br><span class="line"><span class="comment"> *    • width =&gt; w</span></span><br><span class="line"><span class="comment"> *    • height =&gt; h</span></span><br><span class="line"><span class="comment"> *    • color =&gt; c</span></span><br><span class="line"><span class="comment"> *    • background =&gt; bg</span></span><br><span class="line"><span class="comment"> *    • margin =&gt; m</span></span><br><span class="line"><span class="comment"> *    • padding =&gt; p</span></span><br><span class="line"><span class="comment"> *    • border =&gt; bd</span></span><br><span class="line"><span class="comment"> *    </span></span><br><span class="line"><span class="comment"> *  3.约定通用 [组件名称]:(这里不使用缩写，</span></span><br><span class="line"><span class="comment"> *    因为组件名可以自定义，缩写易混淆，会增加记忆成本)</span></span><br><span class="line"><span class="comment"> *    • flex =&gt; flex (这里所指的是弹性盒子)</span></span><br><span class="line"><span class="comment"> *    </span></span><br><span class="line"><span class="comment"> *  4.约定通用 [描述] 缩写:(以大写)</span></span><br><span class="line"><span class="comment"> *    • horizontal =&gt; H</span></span><br><span class="line"><span class="comment"> *    • vertical =&gt; V</span></span><br><span class="line"><span class="comment"> *    • normal =&gt; N</span></span><br><span class="line"><span class="comment"> *    </span></span><br><span class="line"><span class="comment"> *  5.约定通用 [属性值] 缩写:(以属性前缀 '--' + emmet联想风格为缩写)</span></span><br><span class="line"><span class="comment"> *    • center =&gt; --c</span></span><br><span class="line"><span class="comment"> *    • middle =&gt; --m</span></span><br><span class="line"><span class="comment"> *    • space-around =&gt; --sa</span></span><br><span class="line"><span class="comment"> *    </span></span><br><span class="line"><span class="comment"> *  6.约定通用 [状态] 缩写:(以属性前缀 '--' + 状态首字母大写，</span></span><br><span class="line"><span class="comment"> *    这里不使用缩写，因为状态名可以自定义，缩写易混淆，会增加记忆成本)</span></span><br><span class="line"><span class="comment"> *    • active =&gt; --Active</span></span><br><span class="line"><span class="comment"> */</span></span><br></pre></td></tr></table></figure></p>
<p>因为是一边写vue2.0-demo项目一边写文字，所以以上是暂定的部分，后续有更新会及时在这里更新</p>

      
    </div>
    <div class="article-info article-info-index">
      
      <a href="/2016/11/06/css/" class="archive-article-date">
  	<time datetime="2016-11-06T15:57:50.000Z" itemprop="datePublished"><i class="icon-clock"></i>2016-11-06</time>
</a>
      
	<div class="article-tag tagcloud">
		<i class="icon-price-tags"></i>
		<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/css/">css</a></li></ul>
	</div>

      

      <div class="clearfix"></div>
    </div>
  </div>
</article>

  
<nav id="article-nav">
  
    <a href="/2016/11/16/interesting_button_by_css/" id="article-nav-newer" class="article-nav-link-wrap">
      <i class="icon-circle-left"></i>
      <div class="article-nav-title">
        
          使用纯css制作有炫酷交互的按钮
        
      </div>
    </a>
  
  
    <a href="/2016/10/21/vue2-1/" id="article-nav-older" class="article-nav-link-wrap">
      <div class="article-nav-title">vue2.0一起在懵逼的海洋里越陷越深（一）</div>
      <i class="icon-circle-right"></i>
    </a>
  
</nav>




<div class="share_jia">
	<!-- JiaThis Button BEGIN -->
	<div class="jiathis_style">
		<span class="jiathis_txt">Share to: &nbsp; </span>
		<a class="jiathis_button_facebook"></a> 
	    <a class="jiathis_button_twitter"></a>
	    <a class="jiathis_button_plus"></a> 
	    <a class="jiathis_button_tsina"></a>
		<a class="jiathis_button_cqq"></a>
		<a class="jiathis_button_douban"></a>
		<a class="jiathis_button_weixin"></a>
		<a class="jiathis_button_tumblr"></a>
    <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	</div>
	<script type="text/javascript" src="//v3.jiathis.com/code/jia.js?uid=1405949716054953" charset="utf-8"></script>
	<!-- JiaThis Button END -->
</div>






<div class="duoshuo">
	<!-- 多说评论框 start -->
	<div class="ds-thread" data-thread-key="css" data-title="使用BEM+emmet的css书写与命名技巧[未完]" data-url="http://baidu.com/2016/11/06/css/"></div>
	<!-- 多说评论框 end -->
	<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
	<script type="text/javascript">
	var duoshuoQuery = {short_name:"leenty-blog"};
	(function() {
		var ds = document.createElement('script');
		ds.type = 'text/javascript';ds.async = true;
		ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
		ds.charset = 'UTF-8';
		(document.getElementsByTagName('head')[0] 
		 || document.getElementsByTagName('body')[0]).appendChild(ds);
	})();
	</script>
	<!-- 多说公共JS代码 end -->
</div>





      </div>
      <footer id="footer">
  <div class="outer">
    <div id="footer-info">
    	<div class="footer-left">
    		&copy; 2019 leenty
    	</div>
      	<div class="footer-right">
      		<a href="http://hexo.io/" target="_blank">Hexo</a>  Theme <a href="https://github.com/litten/hexo-theme-yilia" target="_blank">Yilia</a> by Litten
      	</div>
    </div>
  </div>
</footer>
    </div>
    <script>
	var yiliaConfig = {
		fancybox: true,
		mathjax: false,
		animate: true,
		isHome: false,
		isPost: true,
		isArchive: false,
		isTag: false,
		isCategory: false,
		open_in_new: false,
		root: "/",
		innerArchive: true
	}
</script>

<script src="/./main.js"></script>


    
<div class="tools-col">
  <ul class="btn-wrap">
    
      <li class="chose" data-hook="tools-section-all"><span class="text">全部</span><i class="icon-book"></i></li>
    
    
      <li data-hook="tools-section-tag"><span class="text">标签</span><i class="icon-price-tags"></i></li>
    
    
      <li data-hook="tools-section-friends"><span class="text">友链</span><i class="icon-link"></i></li>
    
    
      <li data-hook="tools-section-me"><span class="text">我</span><i class="icon-smile"></i></li>
    
  </ul>
  <div class="tools-wrap">
    
    	<section class="tools-section tools-section-all chose">
    	</section>
    

    
    	<section class="tools-section tools-section-tag">
    			<div class="widget tagcloud" id="js-tagcloud">
    				<a href="/tags/ES6/" style="font-size: 10px;">ES6</a> <a href="/tags/css/" style="font-size: 15px;">css</a> <a href="/tags/git/" style="font-size: 10px;">git</a> <a href="/tags/github/" style="font-size: 10px;">github</a> <a href="/tags/gulp/" style="font-size: 10px;">gulp</a> <a href="/tags/hexo/" style="font-size: 12.5px;">hexo</a> <a href="/tags/js/" style="font-size: 12.5px;">js</a> <a href="/tags/other/" style="font-size: 10px;">other</a> <a href="/tags/sublime/" style="font-size: 10px;">sublime</a> <a href="/tags/vim/" style="font-size: 10px;">vim</a> <a href="/tags/vue-router/" style="font-size: 17.5px;">vue-router</a> <a href="/tags/vuejs/" style="font-size: 20px;">vuejs</a> <a href="/tags/vuex/" style="font-size: 12.5px;">vuex</a>
    			</div>
    	</section>
    

    
    	<section class="tools-section tools-section-friends">
  		
  			<div class="friends-wrap" id="js-friends">
  			
  	          <a target="_blank" class="main-nav-link switch-friends-link" href="http://vue2.leenty.com">vue2.0演示地址</a>
  	        
  	          <a target="_blank" class="main-nav-link switch-friends-link" href="http://www.leenty.com/">leenty的博客</a>
  	        
  	          <a target="_blank" class="main-nav-link switch-friends-link" href="https://whqet.github.io/">whqet的博客</a>
  	        
  	          <a target="_blank" class="main-nav-link switch-friends-link" href="https://shenyubin.github.io/">沈雨彬的博客</a>
  	        
  	          <a target="_blank" class="main-nav-link switch-friends-link" href="http://www.deboy.cn">Deboy的博客</a>
  	        
  	        </div>
  		
    	</section>
    

    
    	<section class="tools-section tools-section-me">
  	  	
  	  		<div class="aboutme-wrap" id="js-aboutme">不会捣(xia)鼓(gao)的前端不是好全栈</div>
  	  	
    	</section>
    
  </div>
  
</div>
    <!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>
  </div>
</body>
</html>